package cn.mumzone.pos.presenter;

import cn.mumzone.basic.mvp.AbsPresenter;
import cn.mumzone.basic.net.http.callback.ApiCallBack;
import cn.mumzone.basic.net.response.BaseResponse;
import cn.mumzone.pos.model.OutWarehouseDetailEntity;
import cn.mumzone.pos.model.WarehouseDetailEntity;
import cn.mumzone.pos.model.source.StockRepository;
import cn.mumzone.pos.presenter.contract.WareHouseDetailContract;
import cn.mumzone.pos.presenter.contract.WareHouseOutDetailContract;

/**
 * Created By Dlx
 * on 2019/10/10
 */
public class WarehouseOutDetailPresenter extends AbsPresenter<WareHouseOutDetailContract.View, StockRepository> implements WareHouseOutDetailContract.Presenter {
    @Override
    public void getDetail(String id) {
        ApiCallBack<OutWarehouseDetailEntity> callBack = new ApiCallBack<OutWarehouseDetailEntity>() {
            @Override
            public void onSuccess(OutWarehouseDetailEntity entity) {
                mView.onDetailReceived(entity);
            }

            @Override
            public void onError(BaseResponse response) {
                mView.showToast(response.getMsg());
            }
        };

        mRepo.getOutWarehouseDetail(callBack, id);
        addSubscrebe(callBack);
    }
}
